import redis

# 连接Redis
conn = redis.Redis(host="192.168.5.132")

# 1、添加数据

conn.sadd("friends1", "张三", "李四", "王五", "赵六")  # 创建第一个结合
conn.sadd("friends2", "bill gates", "jack ma", "pony ma", "张三")  # 创建第二个集合


# 2、查看集合的元素
# friends1 = conn.smembers("friends1")
# print(friends1)


# 获取集合的交集
# sinter = conn.sinter("friends1", "friends2")

# print(sinter)

# for item in sinter:
#     print(item.decode("utf-8"))